/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */

package l1j.server.server.serverpackets;

import l1j.server.server.templates.L1EmblemIcon;

// Referenced classes of package l1j.server.server.serverpackets:
// ServerBasePacket

public class S_Emblem extends ServerBasePacket {
	private static final String S_EMBLEM = "[S] S_Emblem";

	// public S_Emblem(final int clanid) {
	// BufferedInputStream bis = null;
	// try {
	// final String emblem_file = String.valueOf(clanid);
	// final File file = new File("emblem/" + emblem_file);
	// if (file.exists()) {
	// int data = 0;
	// bis = new BufferedInputStream(new FileInputStream(file));
	// writeC(Opcodes.S_OPCODE_EMBLEM);
	// writeD(clanid);
	// while ((data = bis.read()) != -1) {
	// writeP(data);
	// }
	// writeC(0x00);//TODO l1j-tw-99nets開發團隊
	// writeH(0x0000);//TODO l1j-tw-99nets開發團隊
	// }
	// }
	// catch (final Exception e) {
	// _log.log(Level.SEVERE, e.getLocalizedMessage(), e);
	// }
	// finally {
	// if (bis != null) {
	// try {
	// bis.close();
	// }
	// catch (final IOException ignore) {
	// _log.log(Level.SEVERE, ignore.getLocalizedMessage(), ignore);
	// }
	// }
	// }
	// }
	public S_Emblem(final L1EmblemIcon emblemIcon) {
		// System.out.println("S_OPCODE_EMBLEM");
		this.writeC(S_OPCODE_EMBLEM);
		this.writeD(emblemIcon.get_clanid());
		this.writeByte(emblemIcon.get_clanIcon());
		/*
		 * final byte[] icon = emblemIcon.get_clanIcon(); for (int i = 0 ; i <
		 * icon.length ; i++) { this.writeC(icon[i]); }
		 */
	}

	@Override
	public byte[] getContent() {
		return this.getBytes();
	}

	@Override
	public String getType() {
		return S_EMBLEM;
	}
}
